﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Animation;
using TowerDefender.Entities;
using TowerDefender.Model;

namespace TowerDefender.Graphics.Animated.Mobs
{
    /// <summary>
    /// Interaction logic for Peon.xaml
    /// </summary>
    public partial class PeonGraphics : UserControl
    {
        public Peon peon { get; set; }

        public PeonGraphics(Peon p)
        {
            InitializeComponent();
            peon = p;
            p.CoordinatesChanged += new EventHandler(p_CoordinatesChanged);
        }

        void p_CoordinatesChanged(object sender, EventArgs e)
        {
            PeonManager.DrawPeon(this, peon);
        }

       

        /*
        public void MoveDown()
        {
            DoubleAnimation da = new DoubleAnimation();
            da.By = 73;
            da.Duration = new TimeSpan(0, 0, speed);
            da.Completed += new EventHandler(da_Completed);
            TranslateTransform tt = new TranslateTransform();
            this.RenderTransform = tt;
            tt.BeginAnimation(TranslateTransform.YProperty, da);

            currentRow += 1;
            
            
        }
        public void MoveUp()
        {
            DoubleAnimation da = new DoubleAnimation();
            da.By = -73;
            da.Duration = new TimeSpan(0, 0, speed);
            da.Completed += new EventHandler(da_Completed);
            TranslateTransform tt = new TranslateTransform();
            this.RenderTransform = tt;
            tt.BeginAnimation(TranslateTransform.YProperty, da);
            currentRow -= 1;
            
            

        }
        public void MoveLeft()
        {
            
            DoubleAnimation da = new DoubleAnimation();
            da.By = -71;
            da.Duration = new TimeSpan(0, 0, speed);
            da.Completed += new EventHandler(da_Completed);
            TranslateTransform tt = new TranslateTransform();
            this.RenderTransform = tt;

            tt.BeginAnimation(TranslateTransform.XProperty, da);
            currentCol -= 1;
           
            
        }
        public void MoveRight()
        {
            DoubleAnimation da = new DoubleAnimation();
            da.By = +71;
            da.Duration = new TimeSpan(0, 0, speed);
            da.Completed += new EventHandler(da_Completed);
            TranslateTransform tt = new TranslateTransform();
            this.RenderTransform = tt;

            tt.BeginAnimation(TranslateTransform.XProperty, da);
            currentRow += 1;
            
            
        }
        public int Direction(String[,] tab)
        {

            return direction;
        }

        public void da_Completed(object sender, EventArgs e)
        {
            Grid.SetRow(this, currentRow);
            Grid.SetColumn(this, currentCol);
            if (direction == 1)
                MoveUp();
            if (direction == 2)
                MoveRight();
            if (direction == 3)
                MoveDown();
            if (direction == 4)
                MoveLeft();
        }*/
        
    }
}
